<template>
  <div>
    <!-- <sellHeader :seller="seller"></sellHeader> -->
    <tab></tab>
    <!-- <button @click="getInfo">请求数据</button> -->
    <!-- 下面是tab的内容 -->
    <router-view :seller="seller" :ratings="ratings" :goods="goods"></router-view>
    <!-- 默认显示goods -->
    <!-- <router-view :goods="goods" aria-dropeffect="goods"></router-view> -->
  </div>
</template>
<script>
import sellHeader from '@/components/header/sellHeader'
import tab from '@/components/tab/tab'
import floating from '@/components/header/floating'
import { getUserInfo } from '@/api/data'

export default {
  name: 'App',
  data () {
    return {
      seller: {},
      goods: [],
      ratings: []
    }
  },
  components: {
    sellHeader,
    tab,
    floating
  },
  beforeCreate () {
    // this.getInfo()
    getUserInfo().then(res => {
        // console.log('res:', res)
        let result = res.data
        this.seller = result.seller
        this.goods = result.goods
        this.ratings = result.ratings
      })
  },
  methods: {
    getInfo() {
      // getUserInfo().then(res => {
      //   // console.log('res:', res)
      //   let result = res.data
      //   this.seller = result.seller
      //   this.goods = result.goods
      //   this.ratings = result.ratings
      // })
    }
  }
}
</script>

<style lang="stylus" scoped>
.tab
  width 100%
  display flex
  height 40px
  line-height 40px
  text-align center
  position relative
  &:after
    display block
    position absolute
    left 0
    bottom 0
    width 100%
    border-top 1px solid rgba(7, 17, 22, 0.5)
    content ''
  &>div
    flex 1
    // border: 2px solid #eee;
</style>
